package pl.pasu.ocrtc;

import android.util.Log;

public class Logger {

    public enum LogLevel {
        NONE, ERROR, WARNING, DEBUG, VERBOSE, INFO, ALL
    }
    private static LogLevel logLevel = LogLevel.ALL;

    public static void initLogLevel(LogLevel lev) {
        logLevel = lev;
    }

    public static void d(final String TAG, String message) {
        if (logLevel.ordinal() >= LogLevel.DEBUG.ordinal()) {
            Log.d(TAG, message);
        }
    }

    public static void e(final String TAG, String message) {
        if (logLevel.ordinal() >= LogLevel.ERROR.ordinal()) {
            Log.e(TAG, message);
        }
    }

    public static void i(final String TAG, String message) {
        if (logLevel.ordinal() >= LogLevel.INFO.ordinal()) {
            Log.i(TAG, message);
        }
    }

    public static void v(final String TAG, String message) {
        if (logLevel.ordinal() >= LogLevel.VERBOSE.ordinal()) {
            Log.v(TAG, message);
        }
    }

    public static void w(final String TAG, String message) {
        if (logLevel.ordinal() >= LogLevel.WARNING.ordinal()) {
            Log.w(TAG, message);
        }
    }
}
